{"ast":null,"code":"import _defineProperty from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport Pagination from '../pagination';\nimport ListItem from './ListItem';\nexport var OmitProps = ['handleFilter', 'handleClear', 'checkedKeys'];\nfunction parsePagination(pagination) {\n  if (!pagination) {\n    return null;\n  }\n  var defaultPagination = {\n    pageSize: 10,\n    simple: true,\n    showSizeChanger: false,\n    showLessItems: false\n  };\n  if (typeof pagination === 'object') {\n    return Object.assign(Object.assign({}, defaultPagination), pagination);\n  }\n  return defaultPagination;\n}\nvar ListBody = /*#__PURE__*/function (_React$Component) {\n  _inherits(ListBody, _React$Component);\n  var _super = _createSuper(ListBody);\n  function ListBody() {\n    var _this;\n    _classCallCheck(this, ListBody);\n    _this = _super.apply(this, arguments);\n    _this.state = {\n      current: 1\n    };\n    _this.onItemSelect = function (item) {\n      var _this$props = _this.props,\n        onItemSelect = _this$props.onItemSelect,\n        selectedKeys = _this$props.selectedKeys;\n      var checked = selectedKeys.includes(item.key);\n      onItemSelect(item.key, !checked);\n    };\n    _this.onItemRemove = function (item) {\n      var onItemRemove = _this.props.onItemRemove;\n      onItemRemove === null || onItemRemove === void 0 ? void 0 : onItemRemove([item.key]);\n    };\n    _this.onPageChange = function (current) {\n      _this.setState({\n        current: current\n      });\n    };\n    _this.getItems = function () {\n      var current = _this.state.current;\n      var _this$props2 = _this.props,\n        pagination = _this$props2.pagination,\n        filteredRenderItems = _this$props2.filteredRenderItems;\n      var mergedPagination = parsePagination(pagination);\n      var displayItems = filteredRenderItems;\n      if (mergedPagination) {\n        displayItems = filteredRenderItems.slice((current - 1) * mergedPagination.pageSize, current * mergedPagination.pageSize);\n      }\n      return displayItems;\n    };\n    return _this;\n  }\n  _createClass(ListBody, [{\n    key: \"render\",\n    value: function render() {\n      var _this2 = this;\n      var current = this.state.current;\n      var _this$props3 = this.props,\n        prefixCls = _this$props3.prefixCls,\n        onScroll = _this$props3.onScroll,\n        filteredRenderItems = _this$props3.filteredRenderItems,\n        selectedKeys = _this$props3.selectedKeys,\n        globalDisabled = _this$props3.disabled,\n        showRemove = _this$props3.showRemove,\n        pagination = _this$props3.pagination;\n      var mergedPagination = parsePagination(pagination);\n      var paginationNode = null;\n      if (mergedPagination) {\n        paginationNode = /*#__PURE__*/React.createElement(Pagination, {\n          simple: mergedPagination.simple,\n          showSizeChanger: mergedPagination.showSizeChanger,\n          showLessItems: mergedPagination.showLessItems,\n          size: \"small\",\n          disabled: globalDisabled,\n          className: \"\".concat(prefixCls, \"-pagination\"),\n          total: filteredRenderItems.length,\n          pageSize: mergedPagination.pageSize,\n          current: current,\n          onChange: this.onPageChange\n        });\n      }\n      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"ul\", {\n        className: classNames(\"\".concat(prefixCls, \"-content\"), _defineProperty({}, \"\".concat(prefixCls, \"-content-show-remove\"), showRemove)),\n        onScroll: onScroll\n      }, this.getItems().map(function (_ref) {\n        var renderedEl = _ref.renderedEl,\n          renderedText = _ref.renderedText,\n          item = _ref.item;\n        var disabled = item.disabled;\n        var checked = selectedKeys.includes(item.key);\n        return /*#__PURE__*/React.createElement(ListItem, {\n          disabled: globalDisabled || disabled,\n          key: item.key,\n          item: item,\n          renderedText: renderedText,\n          renderedEl: renderedEl,\n          checked: checked,\n          prefixCls: prefixCls,\n          onClick: _this2.onItemSelect,\n          onRemove: _this2.onItemRemove,\n          showRemove: showRemove\n        });\n      })), paginationNode);\n    }\n  }], [{\n    key: \"getDerivedStateFromProps\",\n    value: function getDerivedStateFromProps(_ref2, _ref3) {\n      var filteredRenderItems = _ref2.filteredRenderItems,\n        pagination = _ref2.pagination;\n      var current = _ref3.current;\n      var mergedPagination = parsePagination(pagination);\n      if (mergedPagination) {\n        // Calculate the page number\n        var maxPageCount = Math.ceil(filteredRenderItems.length / mergedPagination.pageSize);\n        if (current > maxPageCount) {\n          return {\n            current: maxPageCount\n          };\n        }\n      }\n      return null;\n    }\n  }]);\n  return ListBody;\n}(React.Component);\nexport default ListBody;","map":{"version":3,"names":["_classCallCheck","_createClass","_inherits","_createSuper","classNames","React","Pagination","ListItem","OmitProps","parsePagination","pagination","defaultPagination","pageSize","simple","showSizeChanger","showLessItems","Object","assign","ListBody","_React$Component","_super","_this","apply","arguments","state","current","onItemSelect","item","props","selectedKeys","checked","includes","key","onItemRemove","onPageChange","setState","getItems","filteredRenderItems","mergedPagination","displayItems","slice","value","render","prefixCls","onScroll","globalDisabled","disabled","showRemove","paginationNode","createElement","size","className","total","length","onChange","Fragment","map","_ref","renderedEl","renderedText","onClick","onRemove","getDerivedStateFromProps","_ref2","_ref3","maxPageCount","Math","ceil","Component"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/transfer/ListBody.js"],"sourcesContent":["import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport Pagination from '../pagination';\nimport ListItem from './ListItem';\nexport const OmitProps = ['handleFilter', 'handleClear', 'checkedKeys'];\nfunction parsePagination(pagination) {\n  if (!pagination) {\n    return null;\n  }\n  const defaultPagination = {\n    pageSize: 10,\n    simple: true,\n    showSizeChanger: false,\n    showLessItems: false\n  };\n  if (typeof pagination === 'object') {\n    return Object.assign(Object.assign({}, defaultPagination), pagination);\n  }\n  return defaultPagination;\n}\nlet ListBody = /*#__PURE__*/function (_React$Component) {\n  _inherits(ListBody, _React$Component);\n  var _super = _createSuper(ListBody);\n  function ListBody() {\n    var _this;\n    _classCallCheck(this, ListBody);\n    _this = _super.apply(this, arguments);\n    _this.state = {\n      current: 1\n    };\n    _this.onItemSelect = item => {\n      const {\n        onItemSelect,\n        selectedKeys\n      } = _this.props;\n      const checked = selectedKeys.includes(item.key);\n      onItemSelect(item.key, !checked);\n    };\n    _this.onItemRemove = item => {\n      const {\n        onItemRemove\n      } = _this.props;\n      onItemRemove === null || onItemRemove === void 0 ? void 0 : onItemRemove([item.key]);\n    };\n    _this.onPageChange = current => {\n      _this.setState({\n        current\n      });\n    };\n    _this.getItems = () => {\n      const {\n        current\n      } = _this.state;\n      const {\n        pagination,\n        filteredRenderItems\n      } = _this.props;\n      const mergedPagination = parsePagination(pagination);\n      let displayItems = filteredRenderItems;\n      if (mergedPagination) {\n        displayItems = filteredRenderItems.slice((current - 1) * mergedPagination.pageSize, current * mergedPagination.pageSize);\n      }\n      return displayItems;\n    };\n    return _this;\n  }\n  _createClass(ListBody, [{\n    key: \"render\",\n    value: function render() {\n      const {\n        current\n      } = this.state;\n      const {\n        prefixCls,\n        onScroll,\n        filteredRenderItems,\n        selectedKeys,\n        disabled: globalDisabled,\n        showRemove,\n        pagination\n      } = this.props;\n      const mergedPagination = parsePagination(pagination);\n      let paginationNode = null;\n      if (mergedPagination) {\n        paginationNode = /*#__PURE__*/React.createElement(Pagination, {\n          simple: mergedPagination.simple,\n          showSizeChanger: mergedPagination.showSizeChanger,\n          showLessItems: mergedPagination.showLessItems,\n          size: \"small\",\n          disabled: globalDisabled,\n          className: `${prefixCls}-pagination`,\n          total: filteredRenderItems.length,\n          pageSize: mergedPagination.pageSize,\n          current: current,\n          onChange: this.onPageChange\n        });\n      }\n      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"ul\", {\n        className: classNames(`${prefixCls}-content`, {\n          [`${prefixCls}-content-show-remove`]: showRemove\n        }),\n        onScroll: onScroll\n      }, this.getItems().map(_ref => {\n        let {\n          renderedEl,\n          renderedText,\n          item\n        } = _ref;\n        const {\n          disabled\n        } = item;\n        const checked = selectedKeys.includes(item.key);\n        return /*#__PURE__*/React.createElement(ListItem, {\n          disabled: globalDisabled || disabled,\n          key: item.key,\n          item: item,\n          renderedText: renderedText,\n          renderedEl: renderedEl,\n          checked: checked,\n          prefixCls: prefixCls,\n          onClick: this.onItemSelect,\n          onRemove: this.onItemRemove,\n          showRemove: showRemove\n        });\n      })), paginationNode);\n    }\n  }], [{\n    key: \"getDerivedStateFromProps\",\n    value: function getDerivedStateFromProps(_ref2, _ref3) {\n      let {\n        filteredRenderItems,\n        pagination\n      } = _ref2;\n      let {\n        current\n      } = _ref3;\n      const mergedPagination = parsePagination(pagination);\n      if (mergedPagination) {\n        // Calculate the page number\n        const maxPageCount = Math.ceil(filteredRenderItems.length / mergedPagination.pageSize);\n        if (current > maxPageCount) {\n          return {\n            current: maxPageCount\n          };\n        }\n      }\n      return null;\n    }\n  }]);\n  return ListBody;\n}(React.Component);\nexport default ListBody;"],"mappings":";AAAA,OAAOA,eAAe,MAAM,2CAA2C;AACvE,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,SAAS,MAAM,qCAAqC;AAC3D,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAO,IAAMC,SAAS,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,aAAa,CAAC;AACvE,SAASC,eAAe,CAACC,UAAU,EAAE;EACnC,IAAI,CAACA,UAAU,EAAE;IACf,OAAO,IAAI;EACb;EACA,IAAMC,iBAAiB,GAAG;IACxBC,QAAQ,EAAE,EAAE;IACZC,MAAM,EAAE,IAAI;IACZC,eAAe,EAAE,KAAK;IACtBC,aAAa,EAAE;EACjB,CAAC;EACD,IAAI,OAAOL,UAAU,KAAK,QAAQ,EAAE;IAClC,OA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